@extends('client.layout')
@section('title')
    <title>修改密码</title>
@stop
@section('content')
    <div id="page" class="black-overlay">
        <div  class="page-min-width" >
            <div id="signup-tel">
                <div class="segment">
                    <div class="header">
                        <div class="logo"></div>
                        <a href="{{ url('') }}" id="closebt"><i></i></a>
                    </div>
                    <h3 class="title" style="margin-bottom: 24px;">欢迎来到云享！修改密码</h3>
                    <script type="text/javascript">
                        function checkPhone(){
                            var phone = $('#phone').val();
                            if(!(/^1[34578]\d{9}$/.test(phone))){
                                $("#yphone").html("<font color='red'>请输入正确的电话号码</font>");
                                $('#sub').attr('disabled',"true");
                                return false;
                            }

                        }
                        function cancel() {
                            $("#yphone").html("");
                            var _pwd = $("#ypwd").text();
                            if(_pwd == ""){
                                $('#sub').removeAttr('disabled');
                            }
                        }
                        function checkPwd(){
                            var pwd = $('#pw1').val();
                            var repwd = $('#pw2').val();
                            if(pwd != repwd){
                                $("#ypwd").html("<font color='red'>两次密码不相同</font>");
                                $('#sub').attr('disabled',"true");
                                return false;
                            }
                        }
                        function cancelPwd() {
                            $("#ypwd").html("");
                            var _p = $("#yphone").text();
                            if(_p == ""){
                                $('#sub').removeAttr('disabled');
                            }
                        }
                    </script>
                    <div id="signup-tel-form" method="post" class="form">
                        <form action="{{ url('client/repassword') }}" method="post" >
                            {{csrf_field()}}
                            <span id="msg" style="display: none;">
                            @if( !empty(Session::get('show_warning')))
                                    <div style="width: 100%;height: 30px;margin:0 auto;">
                                    <span style="color: red;display: block;text-align: center;font-size: 18px;line-height: 30px;">{{ Session::get('show_warning') }}</span>
                                </div>
                                @elseif (count($errors) > 0)
                                    @foreach ($errors->all() as $error)
                                        <div style="width: 100%;height: 30px;">
                                        <span style="color: red;display: block; width: 400px;text-align: center;font-size: 20px;line-height: 30px;">{{ $error }}</span>
                                    </div>
                                    @endforeach
                                @endif
                        </span>
                            <script type="text/javascript">
                                var _msg = $('#msg div span').text();
                                if(_msg != ''){
                                    layer.msg(_msg);
                                }
                            </script>
                            <div class="field">
                                <label>帐号</label>
                                <input name="phone" placeholder="手机号码" class="clear-input" required="required" id="phone"  onblur="checkPhone()" onfocus="cancel()">
                                <!-- <span data-tel="" class="text tel-number"></span> -->
                            </div>
                            <span class="ts_span" id="yphone"></span>
                            <div class="field sms">
                                <label>手机验证码</label>
                                <input name="code" placeholder="收到的验证码" class="clear-input">
                                <input type="button" id="btnreg" onclick="register();" class="sms-btn btn " value="获取验证码" />
                            </div>
                            <div class="field">
                                <label>密码</label>
                                <input name="password" type="password" placeholder="设定登录密码" class="clear-input" id="pw1" required="required">
                            </div>
                            <div class="field">
                                <label>确认密码</label>
                                <input type="password" name="d_password" placeholder="请再输入一次登录密码" class="clear-input repassword" id="pw2"  onblur="checkPwd()" onfocus="cancelPwd()"  required="required">
                            </div>
                            <span class="ts_span" id="ypwd"></span>
                            <div class="field sub">
                                <input id="sub" type="submit" value="重置密码" class="btn rbtn disabled">
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@stop